<template>
  <div class="wrap-bg">
      <div 
        class="head-info  pad-b20 padlr320"
        :style="{
            background: `url(${getAssetsImages('bg-img2')}) no-repeat`,
            'background-size': '100% 100%',
        }"
      >
          <head-menu :menuList="menuList"></head-menu>
          <div class="info-l pad-t30">
            <div class="l-tit">{{ serviceInfo.title }}</div>
            <div class="l-tips-txt mar-t20">
              {{ serviceInfo.describe }}
            </div>
            <filter-radio 
              :filterList="serviceInfo.attrs"
              @radioChange="radioChange"
               :styleType="0"
            ></filter-radio>
            <div class="l-price mar-t20">
              <span class="price-unit">￥</span>
              <span class="price-num">{{ serviceInfo.price }}</span>
              <span class="price-label">/件起</span>
            </div>
            <div class="l-btn-box flex mar-t20">
              <div class="btn add-card mar-r20">加入购物车</div>
              <div class="btn buy-btn" @click="toPath('/purchase')">立即购买</div>
            </div>
          </div>
        <div class="info-r flex-a">
          <el-image
            style="width: 400px; height: 400px"
            :src="serviceInfo.type_img"
          />
          <div class="service-box flex-col flex-center">
            <el-image
              style="width: 16px; height: 16px"
              :src="getAssetsImages('service-icon ')"
            />
            <div>在</div>
            <div>线</div>
            <div>咨</div>
            <div>询</div>
          </div>
        </div>
      </div>
    <div class="padlr320">
      <tabs-list 
        :tabsList="serviceInfo.text_tabs"
        @changeTabs="blockTabsChange"
      ></tabs-list>
    </div>
    <el-divider style="margin: 0;"></el-divider>
    <package-comparison :service_id="service_id"></package-comparison>
    <div class="padlr320">
      <service-describe :service_id="service_id" ></service-describe>
    </div>
    <service-process :service_id="service_id"></service-process>
    <material-requested :service_id="service_id"></material-requested>
    <advantage :service_id="service_id" :bgUrl="getAssetsImages('platform-bg')"></advantage>
    <common-problem :service_id="service_id"></common-problem>
    <div class="mar-t60">
      <find-out-details></find-out-details>
    </div>
  </div>
</template>

<script setup>



//  作品版权登记 
import findOutDetails from "@/components/findOutDetails/index.vue"
// 凭条优势组件
import advantage from "@/components/advantage/advantage.vue"
// 常见问题
import commonProblem from "@/components/commonProblem/index.vue";
// 产品描述
import serviceDescribe from "@/components/serviceDescribe/index.vue"
// 所需材料 组件
import materialRequested from "@/components/materialRequested/index.vue"
// 菜单列表
import headMenu from "@/components/headMenu/index.vue"
// 服务流程组件
import serviceProcess from "@/components/serviceProcess/index.vue"
// filter 单选
import filterRadio from "@/components/filterRadio/index.vue"
// 套餐对比
import packageComparison from "@/components/packageComparison/index.vue"
import { reactive, ref } from "vue";
import serviceApi from "@/api/modules/trademarkService.js"
const router = useRouter();
const route = useRoute()
const service_id = ref(route.query.id ?? '')
const toPath = url => {
    if(!url) return
    router.push(url);
};

let objDemo = ref({
  info: { a: 1 },
  child: [1,2,3]
})

let menuList = ref([
  {
    name: "服务商城",
  },
  {
    name: "版权登记",
  },
  {
    name: "作品版权登记",
  },
]);
menuList.value[1].name = route.matched[1].meta.title
menuList.value[2].name = route.query.title
const radioChange = index => {
  console.log(index, "--index");
 }

let tabsCurrent = ref(0)
const blockTabsChange = index => { 
  console.log(index, "--tabsChange");
}
let serviceInfo = ref({})
const getDetail = () => { 
  serviceApi.getDetail({
    id: service_id.value
  }).then(res => { 
    serviceInfo.value = res.data
    serviceInfo.value.attrs.forEach(item => { 
      item.radioCurrent = 0
    })
    console.log(serviceInfo.value.attrs, "--11");
  })
}
getDetail();
const getAssetsImages = (name) => {
  return new URL(`/src/assets/serviceImgs/${name}.png`, import.meta.url).href;
};
</script>
<style lang="scss" scoped>
.block-tips-btn {
  font-size: 16px;
  font-family: PingFang SC, PingFang SC-Regular;
  font-weight: Regular;
  text-align: left;
  color: #0052d9;
}
.block-box {
  position: relative;
  .block-tit {
    font-size: 28px;
    font-family: PingFang SC, PingFang SC-Medium;
    font-weight: Medium;
    text-align: center;
    color: #202020;
    text-align: center;
  }
  .block-img {
    position: absolute;
    right: 324px;
    top: 0;
  }
  .block-li {
    position: relative;
    z-index: 9;
    .li-dot {
      width: 8px;
      height: 8px;
      background: #0052d9;
      border-radius: 50%;
    }
    .li-tit-txt {
      font-size: 16px;
      font-weight: bold;
      text-align: left;
      color: #202020;
    }
    .li-tit-tips {
      font-size: 16px;
      font-family: PingFang SC, PingFang SC-Regular;
      font-weight: Regular;
      text-align: left;
      color: #575966;
    }
  }
}
.line {
  height: 1px;
  border: 1px solid #d2d7dc;
}
.tabs-box {
  .tabs-li {
    width: 20%;
    height: 64px;
    position: relative;
    font-size: 16px;
    font-family: PingFang SC, PingFang SC-Regular;
    font-weight: Regular;
    text-align: center;
    color: #202020;
    line-height: 64px;
    text-align: center;
    cursor: pointer;
    .li-line {
      width: 100%;
      height: 6px;
      background: #0052d9;
      position: absolute;
      left: 0;
      bottom: 0;
    }
  }
  .tabs-li-on {
    color: #0052d9;
  }
}

  .head-info {
    position: relative;
    overflow: hidden;
    .info-r {
        position: absolute;
        right: 320px;
        top: 0;
      .service-box {
        width: 40px;
        height: 125px;
        background: linear-gradient(180deg,#ebf3ff, #ffffff);
        border: 1.5px solid #ffffff;
        border-radius: 24px;
        box-shadow: 0px 4px 20px 0px rgba(213,218,227,0.50); 
        font-size: 16px;
        font-family: PingFang TC, PingFang TC-Regular;
        font-weight: Regular;
        text-align: left;
        color: #202020;
      }
    }
    .info-l {
        position: relative;
        z-index: 9;
      .l-tit {
        font-size: 36px;
        font-family: PingFang SC, PingFang SC-Medium;
        font-weight: Medium;
        text-align: left;
        color: #202020;
      }
      .l-tips-txt {
        font-size: 16px;
        font-family: PingFang SC, PingFang SC-Regular;
        font-weight: Regular;
        text-align: left;
        color: #575966;
      }
      
      .l-price {
        .price-unit,
        .price-num {
          color: #ff4600;
        }
        .price-num {
          font-size: 28px;
          font-family: PingFang SC, PingFang SC-Semibold;
          font-weight: bold;
          text-align: left;
        }
        .price-label {
          font-size: 14px;
          font-family: PingFang SC, PingFang SC-Regular;
          font-weight: Regular;
          text-align: left;
          color: #181818;
        }
      }
      .l-btn-box {
        .btn {
          width: 140px;
          height: 44px;
          border: 1px solid #0052d9;
          border-radius: 4px;
          text-align: center;
          line-height: 44px;
          font-size: 16px;
          font-family: PingFang TC, PingFang TC-Regular;
          text-align: center;
          color: #0052d9;
        }
        .buy-btn {
          background: #0052d9;
          border: none;
          color: #fff;
        }
      }
    }
  }
.head-bg {
  width: 100%;
  position: absolute;
}
</style>
